Loupe - Log - Monitor - Resolve
Gibraltar.Monitor Namespace / Log Class / WriteMessage Method / WriteMessage(LogMessageSeverity,LogWriteMode,Int32,Exception,String,String,String,Object[]) Method
The log message severity.
Whether to queue-and-return or wait-for-commit.
The number of stack frames to skip back over to determine the original caller.
An Exception object to attach to this log message.
Optional. An XML document with extended details about the message. Can be null.
A single line display caption.
Optional. A multi-line description to use which can be a format string for the arguments. Can be null.
Optional. A variable number of arguments to insert into the formatted description string.

In This Topic
    WriteMessage(LogMessageSeverity,LogWriteMode,Int32,Exception,String,String,String,Object[]) Method
    In This Topic
    Write a trace message directly to the Gibraltar log with an optional attached Exception and specifying Queued or WaitForCommit behavior.
    Syntax
    'Declaration
     
    
    Public Overloads Shared Sub WriteMessage( _
       ByVal severity As LogMessageSeverity, _
       ByVal writeMode As LogWriteMode, _
       ByVal skipFrames As Integer, _
       ByVal exception As Exception, _
       ByVal detailsXml As String, _
       ByVal caption As String, _
       ByVal description As String, _
       ByVal ParamArray args() As Object _
    ) 

    Parameters

    severity
    The log message severity.
    writeMode
    Whether to queue-and-return or wait-for-commit.
    skipFrames
    The number of stack frames to skip back over to determine the original caller.
    exception
    An Exception object to attach to this log message.
    detailsXml
    Optional. An XML document with extended details about the message. Can be null.
    caption
    A single line display caption.
    description
    Optional. A multi-line description to use which can be a format string for the arguments. Can be null.
    args
    Optional. A variable number of arguments to insert into the formatted description string.
    Remarks

    This overload of WriteMessage() is provided as an API hook for simple wrapping methods which need to attribute a log message to their own outer callers. Passing a skipFrames of 0 would designate the caller of this method as the originator; a skipFrames of 1 would designate the caller of the caller of this method as the originator, and so on. It will then extract information about the originator automatically based on the indicated stack frame. Bridge logic adapting from a logging system which already determines and provides information about the originator (such as log4net) into Gibraltar should use the other overload of WriteMessage(), passing a customized IMessageSourceProvider.

    This method also requires explicitly selecting the LogWriteMode between Queued (the normal default, for optimal performance) and WaitForCommit (to help ensure critical information makes it to disk, e.g. before exiting the application upon return from this call). See the LogWriteMode enum for more information.

    This method also allows an optional Exception object to be attached to the log message (null for none). And the message may be a simple message string, or a format string followed by arguments.

    Requirements

    Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

    See Also